Skip to content

Make error messages for missing shared libraries more helpful#5607

Merged
zebreus merged 2 commits intofeat/dl-threadsfrom
improve-missing-library-error-message
Jun 16, 2025
Merged

Make error messages for missing shared libraries more helpful#5607
zebreus merged 2 commits intofeat/dl-threadsfrom
improve-missing-library-error-message

Conversation

@zebreus
Copy link
Contributor

@zebreus zebreus commented Jun 15, 2025

The error messages for missing dynamic libraries do not provide any details about why a dynamic library could not be found. This PR makes them more helpful by including the searched paths and the reasons why the library was not found there.

The previous implementation would always show entry not found even when the actual filesystem error was something else.

Previous error message:

error: Spawn failed
╰─▶ 1: Linker error: File system error: entry not found

New error message:

error: Spawn failed
╰─▶ 1: Linker error: Failed to find shared library libexample.so: 
           /lib/libexample.so: entry not found
           /usr/lib/libexample.so: entry not found
           /usr/local/lib/libexample.so: entry not found

Description

@zebreus zebreus requested review from Arshia001 and Copilot June 15, 2025 22:49
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR enhances error messages for missing shared libraries by including details on the searched paths and the underlying filesystem errors. Key changes include introducing a new LinkError variant (SharedLibraryMissing) with a corresponding FsErrors enum to capture single or multiple filesystem errors, and updating the module lookup logic in locate_module to wrap errors with these detailed messages.

Comments suppressed due to low confidence (2)

lib/wasix/src/state/linker.rs:533

  • [nitpick] Consider adding a brief comment above the Display implementation for FsErrors to explain the formatting logic, which will aid future maintainers in understanding the custom error output.
write!(f, "\n    {}: {}", path.display(), error)?;

lib/wasix/src/state/linker.rs:3618

  • [nitpick] Consider checking for duplicate paths when chaining library_path with DEFAULT_RUNTIME_PATH to avoid redundant filesystem lookups, especially if there may be overlap between the two sources.
let search_paths = library_path.iter()

@promptless
Copy link

promptless bot commented Jun 15, 2025

📝 Documentation updates detected!

New suggestion: Add troubleshooting documentation for Wasmer runtime shared library errors

@zebreus zebreus requested a review from Arshia001 June 16, 2025 07:40
@zebreus zebreus merged commit 40d5e8f into feat/dl-threads Jun 16, 2025
73 of 75 checks passed
@zebreus zebreus deleted the improve-missing-library-error-message branch June 16, 2025 07:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants